//
//  DTDeviceAudio.m
//  PersonalManager
//
//  Created by user on 16/8/17.
//  Copyright © 2016年 Haiyun.Qian. All rights reserved.
//

#import "DTDeviceAudio.h"

@implementation DTDeviceAudio

- (instancetype)init {
    if (self = [super init]) {
        self.action = [[DTDeviceAudioAction alloc] init];
    }
    return self;
}

/** 开始录音 */
- (void)startRecord:(DTJavascriptCommand *)command{
    self.action.command = command;
    command.actionObject = self.action;
    [self.action startRecord];
}

/** 停止录音 */
- (void)stopRecord:(DTJavascriptCommand *)command{
    self.action.command = command;
    command.actionObject = self.action;
    [self.action stopRecord];
}

/** 监听录音自动结束 */
- (void)onRecordEnd:(DTJavascriptCommand *)command{
    self.action.command = command;
    command.actionObject = self.action;
    [self.action onRecordEnd];
}

/** 播放 */
- (void)play:(DTJavascriptCommand *)command{
    self.action.command = command;
    command.actionObject = self.action;
    [self.action play];
}

/** 暂停播放 */
- (void)pause:(DTJavascriptCommand *)command{
    self.action.command = command;
    command.actionObject = self.action;
    [self.action pause];
}
/** 断点续播 */
- (void)resume:(DTJavascriptCommand *)command{
    self.action.command = command;
    command.actionObject = self.action;
    [self.action resume];
}

/** 停止播放 */
- (void)stop:(DTJavascriptCommand *)command{
    self.action.command = command;
    command.actionObject = self.action;
    [self.action stop];
}

/** 监听音频播放停止自动调用 */
- (void)onPlayEnd:(DTJavascriptCommand *)command{
    self.action.command = command;
    command.actionObject = self.action;
    [self.action onPlayEnd];
}

/** 下载音频 */
- (void)download:(DTJavascriptCommand *)command{
    self.action.command = command;
    command.actionObject = self.action;
    [self.action download];
}

/** 语音转文字 */
- (void)translateVoice:(DTJavascriptCommand *)command{
    self.action.command = command;
    command.actionObject = self.action;
    [self.action translateVoice];
}


@end
